package com.zwx.string.leetcode_1;

/**
 * 反转字符串
 *
 * @author 文希
 * @create 2019-06-30 7:35
 */
public class ReverseString {

    private static String reverseString(String s) {
        StringBuilder builder = new StringBuilder();
        for (int i = s.length() - 1; i >= 0; i--) {
            builder.append(s.charAt(i));
        }
        return String.valueOf(builder);
    }

    public static void main(String[] args) {
        String s = "hello,wrold";
        String s1 = reverseString(s);
        System.out.println("s1 = " + s1);
    }
}
